import 'package:flutter/material.dart';
import 'package:flutter_structure/common/controllers/state_controller.dart';
import 'package:flutter_structure/app/localization/app_localization.dart';
import 'package:flutter_structure/app/localization/localization_controller.dart';
import 'package:flutter_structure/routes/route_pages.dart';
import 'package:flutter_structure/app/theme/theme_controller.dart';
import 'package:get/get.dart';
import 'theme/app_themes.dart';

class App extends StatefulWidget {
  const App({super.key});
  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  @override
  Widget build(BuildContext context) {

    return Obx(() {
      return GetMaterialApp(
        debugShowCheckedModeBanner: false,
        translations: AppTranslations(),
        locale: LanguageController.to.locale.value, 
        fallbackLocale: const Locale('zh', 'CN') , 
        theme: AppThemes.lightTheme,
        darkTheme: AppThemes.darkTheme,
        themeMode: ThemeController.to.themeMode.value, 
        initialRoute: StateController.to.isFirstLaunch ? '/guide' : '/home',
        getPages: RoutePages.pages,
      );
    });
  }
}


